/*package com.utils.file;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.zip.Adler32;
import java.util.zip.CheckedOutputStream;
import java.util.zip.ZipEntry;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tools.zip.ZipFile;
import org.apache.tools.zip.ZipOutputStream;

*//**
* 调用org.apache.tools.zip实现解压缩。
*//*
public class ZipUtil {
	private final Log logger = LogFactory.getLog(getClass());

	public void zip(String zipFileName, String inputFile) throws Exception {
		zip(zipFileName, new File(inputFile));
	}

	public void zip(String zipFileName, File inputFile) throws Exception {
		ZipOutputStream out = new ZipOutputStream(new FileOutputStream(
				new String(zipFileName.getBytes("gb2312"))));
		zip(out, inputFile, "");
		out.close();
	}

	public void zip(ZipOutputStream out, File f, String base) throws Exception {
		logger.info("Zipping  " + f.getName());
		if (f.isDirectory()) {
			File[] fl = f.listFiles();
			out.putNextEntry(new org.apache.tools.zip.ZipEntry(base + "/"));
			base = base.length() == 0 ? "" : base + "/";
			for (int i = 0; i < fl.length; i++) {
				zip(out, fl[i], base + fl[i].getName());
				logger.info(fl[i].getName());
			}
		} else {
			out.putNextEntry(new org.apache.tools.zip.ZipEntry(base));
			logger.info(base);
			FileInputStream in = new FileInputStream(f);
			int b;

			while ((b = in.read()) != -1)
				out.write(b);
			in.close();
		}

	}

	private void createDirectory(String directory, String subDirectory) throws Exception {
		String dir[];
		File fl = new File(directory);
		try {
			if (subDirectory == "" && fl.exists() != true)
				fl.mkdir();
			else if (subDirectory != "") {
				dir = subDirectory.replace('\\', '/').split("/");
				for (int i = 0; i < dir.length; i++) {
					File subFile = new File(directory + File.separator + dir[i]);
					if (subFile.exists() == false)
						subFile.mkdir();
					directory += File.separator + dir[i];
				}
			}
		} catch (Exception ex) {
			logger.info(ex.getMessage());
			throw ex;
		}
	}
*//**
 * 解压文件到指定路径
 * @author zhaozongyi 
 * @date 2016-11-17
 * @param zipFileName 需解压文件路径
 * @param outputDirectory 指定路径
 * @throws Exception
 *//*
	public void unZip(String zipFileName, String outputDirectory)
			throws Exception {
		try {
			ZipFile zipFile = new ZipFile(zipFileName);
			java.util.Enumeration e = zipFile.getEntries();
			org.apache.tools.zip.ZipEntry zipEntry = null;
			createDirectory(outputDirectory, "");
			while (e.hasMoreElements()) {
				zipEntry = (org.apache.tools.zip.ZipEntry) e.nextElement();
				logger.info("正在解压zip文件: " + zipEntry.getName());
				String name = null;
				if (zipEntry.isDirectory()) {
					name = zipEntry.getName();
					name = name.substring(0, name.length() - 1);
					File f = new File(outputDirectory + File.separator + name);
					f.mkdir();
					logger.info("创建解压缩目录：" + outputDirectory
							+ File.separator + name);
				} else {
					String fileName = zipEntry.getName();
					fileName = fileName.replace('\\', '/');
					if (fileName.indexOf("/") != -1) {
						createDirectory(outputDirectory, fileName.substring(0,
								fileName.lastIndexOf("/")));
						fileName = fileName.substring(
								fileName.lastIndexOf("/") + 1, fileName
										.length());
					}

					File f = new File(outputDirectory + File.separator
							+ zipEntry.getName());

					f.createNewFile();
					byte[] by = new byte[1024];
					InputStream in = zipFile.getInputStream(zipEntry);
					int c;
					FileOutputStream out = new FileOutputStream(f);
					while ((c = in.read(by)) != -1) {
						out.write(by, 0, c);
					}
					 if(null != out) out.close();  //关闭
					 if(null != in) in.close();  //关闭
				}

			}
		} catch (Exception ex) {
			logger.info(ex.getMessage());
			throw ex;
		}

	}

	*//**
	 * 递归删除目录或文件
	 *//*
	public void delBaseDir(File directory) throws Exception {

		File[] lists = directory.listFiles();
		File parentFile = null;
		for (int i = 0; i < lists.length; i++) {
			File f = lists[i];
			if (f.isFile()) {
				f.delete();
				// 若它的父目录没有文件了，说明已经删完，应该删除父目录
				parentFile = f.getParentFile();
				if (parentFile.list().length == 0)
					parentFile.delete();
			} else {
				delBaseDir(f); // 递归调用
			}
		}
	}

	MODIFY BEGIN ZHUDANSHAN 2009-09-23 BY 车船税提取优化
	*//**
	 * 将多个文件生成压缩文件
	 * 
	 * @param originFiles  源文件
	 * @param destZipFilename 目标文件名
	 * @throws Exception
	 *//*
	public void zipFile(HashMap originFiles, String destZipFile) throws Exception {
		int BUFFER = 512;
		if (originFiles == null || originFiles.size() == 0
				|| destZipFile == null || destZipFile.trim().equals("")) {
			return;
		}
		try {
			BufferedInputStream bis = null;
			ZipOutputStream zos = new ZipOutputStream(
				new CheckedOutputStream(new FileOutputStream(destZipFile), new Adler32()));
			Iterator i = originFiles.values().iterator();
			while (i.hasNext()) {
				String fileName = (String) i.next();
				bis = new BufferedInputStream(new FileInputStream(fileName),BUFFER);
				org.apache.tools.zip.ZipEntry entry = new org.apache.tools.zip.ZipEntry(fileName.substring(fileName.lastIndexOf("/") + 1));
				zos.putNextEntry(entry);
				byte data[] = new byte[BUFFER];
				int nNumber = 0;
				while ((nNumber = bis.read(data, 0, BUFFER)) != -1) {
					zos.write(data, 0, nNumber);
				}
				bis.close();
			}
			zos.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	
	public static void main(String[] args) {
		try {
			ZipUtil zip = new ZipUtil();
			zip.zip("ent.xml","D://ws");
			
		} catch (Exception e) {
			e.printStackTrace(System.out);
		}
	}

}
*/